package com.example.demo2.action;

import com.example.demo2.define.CDEvents;
import com.example.demo2.define.CDStates;
import com.example.demo2.define.Variables;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.action.Action;

/**
 * 进入到某个状态执行的事件
 */
public class LoadAction implements Action<CDStates, CDEvents> {
    @Override
    public void execute(StateContext<CDStates, CDEvents> context) {
        Object cd = context.getMessageHeader(Variables.CD);
        context.getExtendedState().getVariables().put(Variables.CD, cd);
        System.out.println("LoadAction, execute 被执行");
    }
}
